package com.iims.finance.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.iims.common.core.domain.BussinessEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.Column;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Positive;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 收款
 *
 * @TableName cmis_cw_collection
 */
@TableName(value = "cmis_cw_collection")
@Data
@BussinessEntity
@ApiModel("收款信息")
public class CmisCwCollection extends CmisFinanceReview {
    /**
     * 收款Id
     */
    @ApiModelProperty(value = "收款Id", required = true)
    @TableId(type = IdType.AUTO)
    private Long collectId;

    /**
     * 合同Id
     */
    @ApiModelProperty(value = "正式合同Id", required = true)
    @Positive(message = "正式合同Id必须有效 >0")
    private Long contractId;

    /**
     * 收款日期
     */
    @ApiModelProperty(value = "收款日期 | yyyy-MM-dd", required = true)
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date collectDate;

    /**
     * 应收金额
     */
    @ApiModelProperty(value = "应收金额/元:最大12位整数2位小数", required = true)
    @Column(length = 14, scale = 2)
    @Positive(message = "应收金额必须有效 >0")
    private BigDecimal needMoney;

    /**
     * 实收金额
     */
    @ApiModelProperty(value = "实收金额/元:最大12位整数2位小数", required = true)
    @Column(length = 14, scale = 2)
    @Positive(message = "实收金额必须有效 >0")
    private BigDecimal reallyCollectMoney;

    /**
     * 收款人
     */
    @ApiModelProperty(value = "收款人(user_code)", required = true)
    @NotBlank(message = "收款人不能为空")
    private String collectUser;

    /**
     * 收款方式
     */
    @ApiModelProperty(value = "收款方式,值来源于字典business_collect_collectType", required = true)
    private Integer collectType;

    /**
     * 收款账户
     */
    @ApiModelProperty(value = "收款账户", required = true)
    @NotBlank(message = "收款账户不能为空")
    private String accountName;

    /**
     * 收款账号
     */
    @ApiModelProperty(value = "收款账号", required = true)
    @NotBlank(message = "收款账号不能为空")
    private String accountNum;

    //vo
    @ApiModelProperty("收款人(中文)")
    @TableField(exist = false)
    private String collectUserCN;
}